<?php namespace Home\Controller; 

use Hdphp\Controller\Controller;

//首页控制器
class IndexController extends Controller{

    public function index(){
// 分配二级菜单
    $cateModel=new \Common\Model\Cate;
    $cateData=$cateModel->get();
	$cateData=Data::channelLevel($cateData);
//	p($cateData);die;
    View::with('cateData',$cateData);
//	分配正在流行
    $cid=$cateModel->where('cname','流行款式')->pluck('cid');
	$popData=Db::table('shop_goods sg')
	->join('shop_category sc','sg.cid','=','sc.cid')
	->where('sc.pid',$cid)
	
	->limit(10)
	->get();
//	$cateData=array_slice($cateData,0,3);
	
    View::with('popData',$popData);
//	分配为您精选
	 $chooseData=Db::table('shop_goods')->orderBy('rand()')->limit(10)->get();
    View::with('chooseData',$chooseData);
	 
//	p($chooseData);die;
       View::make();
    }
}
